/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opgea.appstreet.domain.entities;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ramesh
 */
@Entity
@Table(name = "logo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Logo.findAll", query = "SELECT l FROM Logo l"),
    @NamedQuery(name = "Logo.findById", query = "SELECT l FROM Logo l WHERE l.id = :id")})
public class Logo implements Serializable{
    
    @Id
    @GeneratedValue
    private Long Id;
    @Lob
    @Column(length=10240)
    private byte[] logo;
    @OneToOne(cascade= CascadeType.ALL)
    private Company company;

    public Logo() {
    }

    public Logo(Long Id, byte[] logo, Company company) {
        this.Id = Id;
        this.logo = logo;
        this.company = company;
    }

    public Long getId() {
        return Id;
    }

    public void setId(Long Id) {
        this.Id = Id;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public byte[] getLogo() {
        return logo;
    }

    public void setLogo(byte[] logo) {
        this.logo = logo;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Logo other = (Logo) obj;
        if (this.Id != other.Id && (this.Id == null || !this.Id.equals(other.Id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + (this.Id != null ? this.Id.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "Logo{" + "Id=" + Id + ", logo=" + logo + ", company=" + company + '}';
    }

    
}
